import { reactive, onMounted } from 'vue';
import axios from 'axios';
export default function () {
  // 变量
  let picList = reactive([
    "https://images.xxapi.cn/images/acg/pc/t019f40e06ece54d6ce.jpg"
  ])
  //生命周期
  onMounted(() => {
    alert("图片好看");

  })
  // 方法
  async function addPic() {
    try {
      let result = await axios.get("https://v2.xxapi.cn/api/randomAcgPic?type=pc")
      picList.push(result.data.data)
    } catch (error) {
      alert(error);
    }
  }

  return { picList, addPic }
}